package com.itheima.api.math;

public class MathTest {
    public static void main(String[] args) {
        int abc = Math.abs(-12);    //返回绝对值
        System.out.println("Math.abs(-12) = " + abc);

        double ceil = Math.ceil(10.12);     //向上取整
        System.out.println("Math.ceil(10.12) = " + ceil);

        //Math.floor(double d)      //向下取整
        System.out.println("Math.floor(12.99) = " + Math.floor(12.99));

        //Math.round(float f)       //四舍五入
        System.out.println("Math.round(10.1) = " + Math.round(10.1));
        System.out.println("Math.round(10.6) = " + Math.round(10.6));

        //Math.max(int a , int b)   //获取最大值
        System.out.println("Math.max(10,20) = " + Math.max(10, 20));

        //Math.min(int a , int b)   //获取最小值
        System.out.println("Math.min(10,20) = " + Math.min(10, 20));

        //Math.pow(double a, double b)  //获取a的b次幂
        System.out.println("Math.pow(2,3) = " + Math.pow(2, 3));

        //Math.random()     //返回值为double的正值,[0.0 , 1.0)
        System.out.println("Math.random() = " + Math.random());
    }
}
